﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<PagedList<CourseSystem.Core.Entities.ExaminationInfo>>" %>
<%@ Import Namespace="CourseSystem.Common.Helpers" %>
<%@ Import Namespace="CourseSystem.Core.Enum" %>
<%@ Import Namespace="Webdiyer.WebControls.Mvc" %>
<table width="50%" height="2" border="0" align="center" cellpadding="0" cellspacing="0"
    bordercolor="#FFFFFF">
    <tr>
        <td bgcolor="#FFFFFF">
        </td>
    </tr>
</table>
<table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
    <tr>
        <td width="76" height="25" bgcolor="#D1E5F0">
            <div align="center" class="style13">
                序号</div>
        </td>
        <td width="358" bgcolor="#D1E5F0">
            <div align="center">
                <span class="style5">考试名称</span></div>
        </td>
        <td width="302" bgcolor="#D1E5F0">
            <div align="center">
                <span class="style13">考试时间</span></div>
        </td>
        <td width="100" bgcolor="#D1E5F0">
            <div align="center">
                <span class="style13">操作</span></div>
        </td>
    </tr>
    <% int i = 1;
       var isDoneCommon = false;
       foreach (var item in Model)
       {%>
    <tr class="style1">
        <td height="25">
            <div align="center">
                <%=i++ %></div>
        </td>
        <td>
            <div align="left">
                <%=item.Title %></div>
        </td>
        <td>
            <div align="center">
                <%=item.StartTime.ToString("yyyy-MM-dd HH:mm") %>到<%=item.EndTime.ToString("yyyy-MM-dd HH:mm") %></div>
        </td>
        <td>
            <div align="center">
                <%     var sumInfo =
              item.ExamSummaryInfo.FirstOrDefault(
                  o => o.Uid == UserHelper.Student.Id);
                       var isCommonExam = item.Title.Contains("补考");
                       if (sumInfo != null && sumInfo.IsCommit)
                       {
                           isDoneCommon = true; %>
                已提交
                <%


                       }
                       else
                       {
                           var now = DateTime.Now;
                           if (item.EndTime < now)
                           {
%>已结束<% }else if(item.StartTime > now){ %>未开始<%}
                           else
                           { %>
                <%= Html.ActionLink("进入考试", "ExamDetail", new {item.Id}) %><% }
                       } %>
            </div>
        </td>
    </tr>
    <% } %>
</table>
<table width="98%" height="7" border="0" align="center" cellpadding="0" cellspacing="0"
    bordercolor="#FFFFFF">
    <tr>
        <td class="gray12">
            &nbsp;
        </td>
        <td align="right" class="gray12">
            <%=Html.AjaxPager(Model, new PagerOptions() { ContainerTagName = "span", CssClass = "mvcPager", PageIndexParameterName = "pid", ShowMorePagerItems = false, AlwaysShowFirstLastPageNumber = true, }, new AjaxOptions() { UpdateTargetId = "listDiv" })%>
            共<%=Model.TotalItemCount %>条记录，页<%=Model.CurrentPageIndex %>/<%=Model.TotalPageCount %>
        </td>
    </tr>
</table>
